/*
 * CurrentLocationService.h
 *
 *  Created on: Jun 15, 2011
 *      Author: ToanNhan
 */

#ifndef CURRENTLOCATIONSERVICE_H_
#define CURRENTLOCATIONSERVICE_H_

#include <FBase.h>
#include <FLocations.h>
#include<FUi.h>
#include<FApp.h>

using namespace Osp::Base;
using namespace Osp::Base::Collection;
using namespace Osp::Locations;
using namespace Osp::Ui;
using namespace Osp::Ui::Controls;
using namespace Osp::App;

class ICurrentLocationMember {
protected:
	ICurrentLocationMember(){}
public:
	virtual ~ICurrentLocationMember(){}
	virtual void LocationUpdate(float latitude, float longitude) = 0;
};

class CurrentLocationService : public ILocationListener{
protected:
	static CurrentLocationService *pInstance;
	ArrayListT<ICurrentLocationMember*> *members;
	LocationProvider *pLocProvider;
	CurrentLocationService();
	void Construct();

	float oldLongitude;
	float oldLatitude;

public:
	float getLongitude();
	float getLatitude();

	void AddMember(ICurrentLocationMember &member);
	void RemoveMember(ICurrentLocationMember &member);

	virtual ~CurrentLocationService();

	void GetCurrentLocation(float &longitude, float &latitude);
	static CurrentLocationService* getInstance();

	virtual void OnLocationUpdated (Location &location);
	virtual void OnProviderStateChanged (LocProviderState newState){};

};



#endif /* CURRENTLOCATIONSERVICE_H_ */
